import { deleteAccount } from "@/api/account-management";
import { message } from "ant-design-vue";

export default function useDeleteAccount(callback?: any) {
  const handleDeleteAccount = async (record: any) => {
    try {
      const { id } = record;
      const res = await deleteAccount({
        id
      });
      console.log(res);
      message.success("删除成功");
      callback && callback();
    } catch (e) {
      console.log(e);
    }
  };
  const confirmDeleteAccount = (record: any) => {
    handleDeleteAccount(record);
  };

  const cancelDeleteAccount = () => {
    message.error("取消删除");
  };
  return {
    confirmDeleteAccount,
    cancelDeleteAccount
  }
}